/* article.css */
:root {
  --max-width: 800px;
  --primary-color: #333;
  --secondary-color: #666;
  --background-color: #f5f5f5;
  --border-color: #e0e0e0;
}

.article {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--primary-color);
}

/* 文章头部 */
.article-header {
  text-align: center;
  margin-bottom: 2rem;
}

.article-header h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-meta {
  color: var(--secondary-color);
  font-size: 0.9rem;
}

/* 主图 */
.main-image {
  margin: 2rem 0;
}

.main-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.image-caption {
  margin-top: 0.5rem;
  color: var(--secondary-color);
  font-size: 0.9rem;
  text-align: center;
}

.image-credit {
  font-style: italic;
  color: #888;
  margin-left: 0.5rem;
}

/* 文章内容 */
.article p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.article p.lead {
  font-size: 1.2rem;
  font-weight: 500;
  color: #444;
}

.section {
  margin: 2rem 0;
}

.section h2 {
  font-size: 1.8rem;
  margin: 1.5rem 0;
  color: #222;
}

/* 相关文章 */
.related-articles {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.related-articles h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.related-articles-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.related-article {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.related-article:hover {
  transform: translateY(-3px);
}

.related-article img {
  width: 100%;
  height: 120px; /* 固定高度，保持一致性 */
  object-fit: cover;
}

.related-article h4 {
  font-size: 1rem;
  margin: 0.8rem;
  line-height: 1.4;
}

.related-article a {
  text-decoration: none;
  color: inherit;
}

/* 互动功能 */
.article-actions {
  margin: 2rem 0;
  display: flex;
  gap: 1rem;
}

.article-actions button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  background: #007bff;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

.article-actions button:hover {
  background: #0056b3;
}

/* 评论区样式 */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.comments-section h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

/* 评论列表 */
.comments-list {
  margin-bottom: 2rem;
}

.comment-item {
  padding: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.comment-author {
  font-weight: 500;
  color: var(--primary-color);
}

.comment-time {
  font-size: 0.9rem;
  color: var(--secondary-color);
}

.comment-content {
  color: var(--primary-color);
  line-height: 1.5;
  margin: 0.5rem 0;
}

.comment-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.comment-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  color: var(--secondary-color);
  background: none;
  border: none;
  cursor: pointer;
}

.comment-actions button:hover {
  color: var(--primary-color);
}

/* 评论表单 */
.comment-form {
  margin-top: 2rem;
}

.comment-form textarea {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.comment-form button {
  padding: 0.75rem 1.5rem;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.comment-form button:hover {
  background: #0056b3;
}

/* 评论分页 */
.comments-pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.pagination-button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

.pagination-button:hover {
  background: #f0f0f0;
}

.pagination-button.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

/* 评论为空状态 */
.comments-empty {
  text-align: center;
  padding: 2rem;
  color: var(--secondary-color);
}

/* 评论加载状态 */
.comments-loading {
  text-align: center;
  padding: 2rem;
  color: var(--secondary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .comment-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .comment-time {
    margin-top: 0.25rem;
  }

  .comment-form button {
    width: 100%;
  }

  .comments-pagination {
    flex-wrap: wrap;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .article {
    padding: 15px;
  }

  .article-header h1 {
    font-size: 2rem;
  }

  .related-articles-list {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 480px) {
  .article-header h1 {
    font-size: 1.8rem;
  }

  .related-articles-list {
    grid-template-columns: 1fr;
  }
}
